﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using TGBTech.Core.Models;
using TGBTech.Core.Models.ChungTu;
using TGBTech.Core.Models.DanhMuc;
using System.Data.Entity.ModelConfiguration.Conventions;
using TGBTech.Core.Models.Models.BaoCao;
using TGBTech.Core.Models.Models.BaoCao.SoCaiTaiKhoanModel;
using TGBTech.Core.Models.Models.DanhMuc;

namespace TGB.Core.Infrastructure
{
    public class TGBTechDb : DbContext
    {
        private const string _defaultConnectionStringName = "DefaultConnection";

        public TGBTechDb()
            : base(_defaultConnectionStringName)
        {
            
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            MigrateDatabaseToLatestVersion<TGBTechDb, Configuration> migrateDatabaseConfiguration = new MigrateDatabaseToLatestVersion<TGBTechDb, Configuration>();
            Database.SetInitializer(migrateDatabaseConfiguration);

            modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
            
            base.OnModelCreating(modelBuilder);

        }

        public DbSet<Data> Data { get; set; }
        public DbSet<ChiTietHangHoa> ChiTietHangHoa { get; set; }
        public DbSet<KhachHang> KhachHang { get; set; }
        public DbSet<HangHoa> HangHoa { get; set; }
        public DbSet<TaiKhoan> TaiKhoan { get; set; }
        public DbSet<TaiKhoanCDKT> TaiKhoanCDKT { get; set; }
        public DbSet<TaiKhoanSo> TaiKhoanSo { get; set; }

        /// <summary>
        /// BAO CAO
        /// </summary>
        /// 
        // Bang can doi ke toan

        // Bao cao ket qua kinh doanh
        public DbSet<BCKetQuaKinhDoanh> BCKetQuaKinhDoanh { get; set; }
        public DbSet<CTBCKetQuaKinhDoanh> CTBCKetQuaKinhDoanh { get; set; }

        public DbSet<ChiTietMaSo> ChiTietMaSo { get; set; }

        public DbSet<SoNhatKyChung> SoNhatKyChung { get; set; }

        public DbSet<TGBTech.Core.Models.Models.BaoCao.NhatKyChungModel.NhatKyChung> NhatKyChung { get; set; }

        public DbSet<SoCaiTaiKhoanChiTiet> SoCaiTaiKhoanChiTiet { get; set; }

        public DbSet<SoCaiTaiKhoan> SoCaiTaiKhoan { get; set; }


        public System.Data.Entity.DbSet<TGBTech.Core.Models.Models.ChungTu.ChungTuXuat> ChungTuXuats { get; set; }

        public System.Data.Entity.DbSet<TGBTech.Core.Models.Models.ChungTu.CTChungTuXuat> CTChungTuXuats { get; set; }

        public System.Data.Entity.DbSet<TGBTech.Core.Models.Models.ChungTu.ChungTuNhap> ChungTuNhaps { get; set; }

        public System.Data.Entity.DbSet<TGBTech.Core.Models.Models.ChungTu.CTChungTuNhap> CTChungTuNhaps { get; set; }

        public System.Data.Entity.DbSet<TGBTech.Core.Models.Models.ChungTu.HoaDon> HoaDons { get; set; }

        public System.Data.Entity.DbSet<TGBTech.Core.Models.Models.ChungTu.CTHoaDon> CTHoaDons { get; set; }

    }
}
